#ifndef __H_VS_TERRAIN__
#define __H_VS_TERRAIN__

#include "const_define.fx"
#include "struct_define.fx"
#include "light_calc.fx"
#include "fog_calc.fx"

VSO_TERRAIN VS_TERRAIN(VSI_NORMAL IN)
{
	VSO_TERRAIN OUT;
	float4 pos = float4(IN.position, 1.0f);
	OUT.position = mul(pos, MAT_WORLD_VIEW_PROJ);
	OUT.diffuse = CalcDiffuse(lightDirection, IN.normal, diffuseLight);
	OUT.normal = IN.normal;
	OUT.texCoord = IN.texCoord;
	OUT.lookDir = normalize(eyePos - IN.position);
	return OUT;
}


VSO_TERRAIN_PUV VS_TERRAIN_PUV(VSI_NORMAL IN)
{
	VSO_TERRAIN_PUV OUT;
	float4 pos = float4(IN.position, 1.0f);
	OUT.position = mul(pos, MAT_WORLD_VIEW_PROJ);
	OUT.diffuse = CalcDiffuse(lightDirection, IN.normal, diffuseLight);
	OUT.normal = IN.normal;
	OUT.texCoord = IN.texCoord;
	OUT.lookDir = normalize(eyePos - IN.position);
	OUT.texProj = mul(pos, MAT_PROJ_TEXTURE).xy;
	return OUT;
}

VSO_TERRAIN_FOG VS_TERRAIN_FOG(VSI_NORMAL IN)
{
	VSO_TERRAIN_FOG OUT;
	float4 pos = float4(IN.position, 1.0f);
	OUT.position = mul(pos, MAT_WORLD_VIEW_PROJ);
	OUT.diffuse = CalcDiffuse(lightDirection, IN.normal, diffuseLight);
	OUT.normal = IN.normal;
	OUT.texCoord = IN.texCoord;
	OUT.lookDir = normalize(eyePos - IN.position);
	OUT.fog = calc_normal_fog(IN.position);
	return OUT;
}

VSO_TERRAIN_PUV_FOG VS_TERRAIN_PUV_FOG(VSI_NORMAL IN)
{
	VSO_TERRAIN_PUV_FOG OUT;
	float4 pos = float4(IN.position, 1.0f);
	OUT.position = mul(pos, MAT_WORLD_VIEW_PROJ);
	OUT.diffuse = CalcDiffuse(lightDirection, IN.normal, diffuseLight);
	OUT.normal = IN.normal;
	OUT.texCoord = IN.texCoord;
	OUT.lookDir = normalize(eyePos - IN.position);
	OUT.texProj = mul(pos, MAT_PROJ_TEXTURE).xy;
	OUT.fog = calc_normal_fog(IN.position);
	return OUT;
}

#endif // __H_VS_TERRAIN__